import request from '@/utils/request'

export default {
  // 1.获取分类列表
  getCateList () {
    return request({
      url: '/my/cate/list',
      method: 'get'
    })
  },

  // 2.添加文章分类
  addCate ({ cate_name, cate_alias }) {
    return request({
      url: '/my/cate/add',
      method: 'post',
      data: {
        cate_name,
        cate_alias
      }
    })
  },

  // 3.根据id获取文章详情
  getArtDetail (id) {
    return request({
      url: '/my/cate/info',
      method: 'get',
      params: {
        id
      }
    })
  },

  // 4.更新文章分类
  updateArtDetail ({ id, cate_name, cate_alias }) {
    return request({
      url: '/my/cate/info',
      method: 'put',
      data: {
        id,
        cate_name,
        cate_alias
      }
    })
  },

  // 5.删除文章分类
  deleteArtCate (id) {
    return request({
      url: '/my/cate/del',
      method: 'delete',
      params: {
        id
      }
    })
  },

  // 6.获取文章列表
  getArtList ({ pagenum, pagesize, cate_id, state }) {
    return request({
      url: '/my/article/list',
      method: 'get',
      params: {
        pagenum,
        pagesize,
        cate_id,
        state
      }
    })
  },

  // 7.根据id获取文章详情
  getArtDetailById (id) {
    return request({
      url: '/my/article/info',
      method: 'get',
      params: {
        id
      }
    })
  },

  // 8.根据id删除文章
  deleteArtById (id) {
    return request({
      url: '/my/article/info',
      method: 'delete',
      params: {
        id
      }
    })
  },

  // 9.新增文章
  addArticle (fd) {
    return request({
      url: '/my/article/add',
      method: 'post',
      data: fd
    })
  }

}
